package com.study.graph.util;

import java.io.File;


public class DiskMon {

	public static boolean reachSize(String check_file,double max_size){
		File file = new File(check_file);
		if(!file.exists()){
			return false;
		}
		else{
			//double free = dirfile.getUsableSpace();
			double all = file.length();
			if(all > max_size){
				return true;
			}
			else {
				return false;
			}
		}
	}
	
	public static boolean reachDiskRatio(String check_dir,double check_ratio){
		File dirfile = new File(check_dir);
		if(!dirfile.exists()){
			return false;
		}
		else{
			double free = dirfile.getUsableSpace();
			double all = dirfile.getTotalSpace();
			if((double)(all-free)/all > check_ratio){
				return true;
			}
			else {
				return false;
			}
		}
	}
	
	
	
}
